#include <iostream>
#include <cstdio>
using namespace std;
int p1,p2,p3;
int a,b,c;
int main()
{
	int n;
	cin >> n;
	while(n--)
     {
     	cin >> a >> b >> c;
     	p1+=a;
     	p2+=b;
     	p3+=c;
	 }
	 int p = p1+p2+p3;
	 cout << p1 << " " << p2 << " "<< p3 << " " << p;
   
   		
}

